<%@page import="study.itwill.team5.board.BoardCategory"%>

<%@page import="study.itwill.common.PatternChecker"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%
	String seq = request.getParameter("seq");

	if (!PatternChecker.isValue(seq)) {
		out.print("<script type='text/javascript'>alert('파라미터가 없습니다.'); history.back();</script>");
		return;
	}
	if (!PatternChecker.isNum(seq)) {
		out.print("<script type='text/javascript'>alert('파라미터 입력이 잘못됐습니다.'); history.back();</script>");
		return;
	}

	int BoardCategory_number = Integer.parseInt(seq);
%>
	<%@include file="../dbcon.jsp" %>
	<%
	BoardCategory boca = new BoardCategory();
	boolean result = boca.deleteBoardCategory(BoardCategory_number);
	
	DBHandler.disconnect();
	
	if(!result){
		out.print("<script type='text/javascript'>alert('삭제에 실패했습니다'); history.back();</script>");
		return;
		
	}
	
	// 삭제 성공시 목록으로 이동
	response.sendRedirect("listBoardCategory.jsp");
	%>
<!DOCTYPE html>
<html lang="ko">
	<head>
		<%@include file="../head.jsp" %>
	</head>

	<body>
		<!-- 메뉴바 -->
		<div class="container">
			
		</div>
		<!-- Javascript -->
		<script src="/italia/assets/js/jquery.js"></script>
		<script src="/italia/assets/js/bootstrap.min.js"></script>
	</body>
</html>






